// [[ OnflowGenerator File UUID: 3121a5216ee7406f80ce5421fc961291  ]]
package com.itdct.onflow.system.monitor.controller

import com.itdct.onflow.core.type.*
import com.itdct.onflow.core.vo.KeyLabelValueVo
import com.itdct.onflow.core.vo.RespPageVo
import com.itdct.onflow.core.vo.RespVo
import com.itdct.onflow.system.common.base.BaseSysController
import com.itdct.onflow.system.monitor.qo.SysMachineInfoEditQo
import com.itdct.onflow.system.monitor.qo.SysMachineInfoSearchQo
import com.itdct.onflow.system.monitor.service.SysMachineInfoService
import com.itdct.onflow.system.monitor.vo.SysMachineInfoDetailVo
import com.itdct.onflow.system.monitor.vo.SysMachineInfoListVo
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.MediaType
import org.springframework.validation.annotation.Validated
import org.springframework.web.bind.annotation.*

/**
 * @author DCTANT
 * @date 2025-10-13 10:48:15
 * @version 1.0
 * @description 服务器信息接口控制
 */
@Tag(name = SysMachineInfoController.moduleName)
@RestController
@RequestMapping(value = ["/sysMachineInfo"], produces = [MediaType.APPLICATION_JSON_VALUE], method = [RequestMethod.POST])
class SysMachineInfoController(
    val sysMachineInfoService: SysMachineInfoService
) : BaseSysController() {
    companion object {
        const val moduleName = "服务器信息"
    }

    @Operation(summary = moduleName + "添加")
    @PostMapping("/add.adw")
    fun add(@RequestBody @Validated(Add::class) qo: SysMachineInfoEditQo): RespVo<Long> {
        return sysMachineInfoService.add(qo, getContext())
    }

    @Operation(summary = moduleName + "更新")
    @PostMapping("/update.adw")
    fun update(@RequestBody @Validated(Update::class) qo: SysMachineInfoEditQo): RespVo<Unit> {
        return sysMachineInfoService.update(qo, getContext())
    }

    @Operation(summary = moduleName + "删除")
    @PostMapping("/delete.adw")
    fun delete(@RequestBody @Validated(Delete::class) qo: SysMachineInfoEditQo): RespVo<Unit> {
        return sysMachineInfoService.delete(qo, getContext())
    }

    @Operation(summary = moduleName + "详情")
    @PostMapping("/detail.adw")
    fun detail(@RequestBody @Validated(Detail::class) qo: SysMachineInfoSearchQo): RespVo<SysMachineInfoDetailVo> {
        return sysMachineInfoService.detail(qo, getContext())
    }

    @Operation(summary = moduleName + "列表")
    @PostMapping("/page.adw")
    fun page(@RequestBody @Validated(Page::class) qo: SysMachineInfoSearchQo): RespPageVo<SysMachineInfoListVo> {
        return sysMachineInfoService.page(qo, getContext())
    }

    // [[ OnflowGenerator Range (- selectFunctions -) Start ]]
    @Operation(summary = moduleName + "服务器id下拉选")
    @PostMapping("/selectMachineIdList.adw")
    fun selectMachineIdList(@RequestBody qo: SysMachineInfoSearchQo): RespVo<List<KeyLabelValueVo>> {
        return sysMachineInfoService.selectMachineIdList(qo, getContext())
    }

// [[ OnflowGenerator Range (- selectFunctions -) End ]]
}